<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Play extends MY_Controller {

  	
    function __construct()
    {
        parent::__construct();
		
    }
    
    
 	function index(){	
 		
 		if($this->Register_model->userIsRegistered() === false){
			redirect('/');
		}
 		
		$this->data['title'] = 'teaboy';
		$this->load->view('pages/play', $this->data);
 	}

	function newGame(){
		$this->Play_model->newGame();
	}

 	function doShake($drinkerId, $gameId, $duration, $beverage){
 		error_log('SHAKE: '.$drinkerId.'-'.$gameId.'-'.$duration);
 		$duration = (int) $duration;
 		$this->Play_model->shake($drinkerId, $gameId, $duration, $beverage);
 	}
 	
 	function endGame(){
 		$this->Play_model->endGame();
 		
 	}
 	
 	function jumpstart(){
 		echo __FUNCTION__;
 		
 		$this->Notify_model->gameStart();
 	}
 	
 	function tellWinners(){
 		echo $this->Notify_model->sendResults();
 	}
    
}